package modelo;

import java.util.Hashtable;

import utils.CmdLineParser;
import utils.CmdLineParser.Option;


public class Jarguments extends CmdLineParser{
	CmdLineParser jArgs;
	private int maxPlayer;
	private int minPlayer;
	private int maxMoves;
	private int port;
	private Double ipAddress;
	public Option<Integer> MAX_PLAYERS = new
            CmdLineParser.Option.IntegerOption('M',"MAX_PLAYERS"); 
	public Option<Integer> MIN_PLAYERS=new
            CmdLineParser.Option.IntegerOption('N', "MIN_PLAYERS"); 
	public Option<Integer> MAX_MOVES=new
            CmdLineParser.Option.IntegerOption('O', "MAX_MOVES"); 
	public Option<Integer> PORT=new
            CmdLineParser.Option.IntegerOption('P', "PORT"); 
	public Option<Double> IP_ADRESS=new
            CmdLineParser.Option.DoubleOption('i', "IP_ADRESS"); 
	Hashtable<String, String> keysValuesReturn ;

	public Jarguments() {
		jArgs = new CmdLineParser();
		keysValuesReturn= new Hashtable<String, String> ();
		// debo intentar leer los argumentos que quiero desde un fichero
		// properties (POR HACER )
		MAX_PLAYERS=jArgs.addOption(MAX_PLAYERS);
		MIN_PLAYERS=jArgs.addOption(MIN_PLAYERS);
		MAX_MOVES=jArgs.addOption(MAX_MOVES);
		PORT=jArgs.addOption(PORT);
		IP_ADRESS=jArgs.addOption(IP_ADRESS);
		
		
	}

//	public String[] parse (String[] args) throws Exception {
//		
//		jArgs.parse(args);	
//		
//		maxPlayer=jArgs.getOptionValue(MAX_PLAYERS);
//		keysValuesReturn.put("maxPlayer", String.valueOf(maxPlayer));
//		minPlayer=jArgs.getOptionValue(MIN_PLAYERS);
//		keysValuesReturn.put("minPlayer",String.valueOf(minPlayer ));
//		maxMoves=jArgs.getOptionValue(MAX_MOVES);
//		keysValuesReturn.put("maxMoves",String.valueOf(maxMoves ));
//		port=jArgs.getOptionValue(PORT);
//		keysValuesReturn.put("port",String.valueOf(port ));
//		ipAddress=jArgs.getOptionValue(IP_ADRESS);
//		keysValuesReturn.put("ipAddress", String.valueOf(ipAddress));
//		return jArgs.getRemainingArgs();
//	}

	public Hashtable<String, String> getKeysValuesReturn() {
		return keysValuesReturn;
	}


	public CmdLineParser getjArgs() {
		return jArgs;
	}

	public String getMaxPlayer() {
		return String.valueOf(getOptionValue(MAX_PLAYERS));
	}

	public int getMinPlayer() {
		return minPlayer;
	}

	public int getMaxMoves() {
		return maxMoves;
	}

	public int getPort() {
		return port;
	}

	public Double getIpAddress() {
		return ipAddress;
	}


}
